package com.gitee.taotaojs.generator;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import org.junit.Assert;
import org.junit.Test;

/**
 * @author TaoTaojs
 * @date 2020/8/25 3:14 PM
 * <p>Description</p>
 * <h2>功能描述</h2>
 *
 * <h3>主要功能：</h3>
 * <ol>
 *     <li>yeifei项目代码生成工具</li>
 * </ol>
 * <h3>关联类</h3>
 * <p>参考链接：</p>
 * <h2>更新日志</h2>
 * [author]        [time]                      [version]          [desc]
 * TaoTaojs        2020/8/25 3:14 PM             V1.0
 */
public class CodeGeneratorTestByYefie1 {

    @Test
    public void getNorm() {
        Assert.assertTrue(true);
        DataSourceConfig dataSourceConfig  = new DataSourceConfig();

        GeneratorBean generatorNorm = GeneratorBean.builder()
                .absolutePath("/Users/work/WorkspacesIDEA/ronghanyiguan/thinkdid-hospital2.0/shxd-service/shxd-service-norm")
                .absolutePath("/Users/work/WorkspacesIDEA/myproject/yefei/wind-all/wind-server/wind-web/wind-vue/")
                .packageName("com.taotaojs.service")
                .modelName("bases")
                .dataSourceConfig(
                        dataSourceConfig.setDbType(DbType.MYSQL)
                                .setDriverName("com.mysql.cj.jdbc.Driver")
                                .setUrl("jdbc:mysql://localhost:3306/yefei1" +
                                        "?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false")
                                .setUsername("root")
                                .setPassword("123456"))
                .build();
        CodeGenerator.generator(
                "tb_bases",
                generatorNorm, false);
    }

    /**
     * 初始化自定义MVC
     */
    @Test
    public void getTable() {
        Assert.assertTrue(true);
        DataSourceConfig dataSourceConfig  = new DataSourceConfig();

        GeneratorBean generatorNorm = GeneratorBean.builder()
                .absolutePath("/Users/work/WorkspacesIDEA/ronghanyiguan/thinkdid-hospital2.0/shxd-service/shxd-service-norm")
                .absolutePath("/Users/work/WorkspacesIDEA/myproject/yefei/wind-all/wind-server/wind-web/wind-vue/")
                .packageName("com.taotaojs.service")
                .modelName("bases")
                .dataSourceConfig(
                        dataSourceConfig.setDbType(DbType.MYSQL)
                                .setDriverName("com.mysql.cj.jdbc.Driver")
                                .setUrl("jdbc:mysql://120.78.171.115:3306/wind" +
                                        "?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false")
                                .setUsername("root")
                                .setPassword("123456"))
                .build();
        CodeGenerator.generator(
                "tb_",
                generatorNorm, false);
    }

    /**
     * 初始化飞廉MVC
     */
    @Test
    public void getSys() {
        Assert.assertTrue(true);
        DataSourceConfig dataSourceConfig  = new DataSourceConfig();

        GeneratorBean generatorNorm = GeneratorBean.builder()
                .absolutePath("/Users/work/WorkspacesIDEA/ronghanyiguan/thinkdid-hospital2.0/shxd-service/shxd-service-norm")
                .absolutePath("/Users/work/WorkspacesIDEA/myproject/yefei/wind-all/wind-server/wind-web/wind-vue/")
                .packageName("com.taotaojs.service")
                .modelName("bases")
                .dataSourceConfig(
                        dataSourceConfig.setDbType(DbType.MYSQL)
                                .setDriverName("com.mysql.cj.jdbc.Driver")
                                .setUrl("jdbc:mysql://localhost:3306/wind_yf" +
                                        "?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false")
                                .setUsername("root")
                                .setPassword("123456"))
                .build();
        CodeGenerator.generator(
                "sys_",
                generatorNorm, false);
    }

}
